<?
layout("/inc/win_layout.html",{title:sysTitle}){
    ?>

 <!--BEGIN CONTENT-->
      <div class="page-content">    
      <div class="row mbl">
           <div class="col-lg-6">
               <div class="input-group input-group-sm mbs">
					<span class="input-group-btn">
						<select id="queryParams" data-toggle="dropdown" class="btn btn-danger dropdown-toggle" style="width :130px;">
		                  <option value="name">数据源名称</option>
		                   
                    	</select>
                   	</span> 
                   		 <input id="text" type="text" placeholder="请输入关键词..." class="form-control" /><span
						class="input-group-btn"><button type="button"
							data-toggle="dropdown" class="btn btn-success dropdown-toggle" onclick="demo1(1)">搜索</button>
					</span>
				</div>
			</div>
		 	
		</div>

		<table
			class="table table-hover table-striped table-bordered table-advanced tablesorter mbn">
			 <thead>
                <tr>                 
                    <th >选择</th>
                    <th >序号</th>
                    <th >数据源名称</th>
                    <th >数据源描述</th>
                    <th >数据源类型</th>
                </tr>
            </thead>
			<tbody id="findallDictItem"></tbody>

		</table>
		<div id="dataNull" class="panel-body"
				style="height: 90px; line-height: 50px;" align="center">
				<span class='subtitle' style="font-size: 15px;">数据为空!</span>
		</div>
<div id="page2" style="text-align: center; margin-top: 20px;">
	</div>
</div>

<?} ?>
<!-- 
<iframe name="child" src="dictItem-add-updateBiao.html" id="ifr" style="HEIGHT: 0px; LEFT: 0px; POSITION: absolute;  WIDTH: 0px"></iframe>
 -->
<script>
function getQueryString(name) { 
	var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i"); 
	var r = window.location.search.substr(1).match(reg); 
	if (r != null) return unescape(r[2]); return null; 
	} 
	var winName=getQueryString("winName");
	var curr;
	$(function() {
		demo1(1);
	});
	function demo1(curr) {
			$.getJSON("./findallDataSource.do",
				{
					"page" : curr || 1,
					"pageNumber":5,
					"queryParams":$("#queryParams").val(),
			        "text":$("#text").val()
				},
				function(res) {
							//此处仅仅是为了演示变化的内容
							var str = "";
					 if(res.listsize>0){
					$("#dataNull").hide();
				}else{
					$("#dataNull").show();
				}
							$("#findallDictItem").html("");					
							for ( var i = 0; i < res.listsize; i++) {
							//alert("id :"+res.result[i].id+"nameZh :  "+res.result[i].nameZh+ "  nameEn:  "+ res.result[i].nameEn+"  sort:  "+res.result[i].sort+"  dict:  "+res.result[i].dictNameZh);
								str += "<tr>"
								
								+" <td><input type=\"radio\" name=\"payMethod\" value="+res.result[i].id+"  /></td><td align=\"center\">"	
								+ (i + 1)
								+"</td><td> <label id="+res.result[i].id+" for="+res.result[i].id+">"+ res.result[i].name + "</label></td>"
								+"<td>"+ res.result[i].description + "</td>"
								+"<td> <label id="+res.result[i].id+"_type for="+res.result[i].id+">"+ res.result[i].sourceType + "</label></td>"
								+ "</tr>";
							}	
								$("#findallDictItem").append(str);
						laypage({
						cont : document.getElementById("page2"), //容器。值支持id名、原生dom对象，jquery对象,
						pages : res.pageSize, //总页数
						skip : true, //是否开启跳页
						curr : curr || 1,
						last: res.pageSize,
						skin : 'molv', //加载内置皮肤，也可以直接赋值16进制颜色值，如:#c00
						groups : 6,//连续显示分页数
						jump : function(obj, first) { //触发分页后的回调
							if (!first) { //点击跳页触发函数自身，并传递当前页：obj.curr
								demo1(obj.curr);
				                 curr=obj.curr;
							}
						}
					});
								
						});
	};
		function save()
		{

		var id = $("input[name='payMethod']:checked").val();
		var name=document.getElementById(id).innerHTML; 
		var type=document.getElementById(id+"_type").innerHTML; 
		var index = parent.layer.getFrameIndex(window.name); 
	    window.parent.window[winName].$("#dataSourceId").val(id);
	    window.parent.window[winName].$("#dataSourceName").val(name);
	    window.parent.window[winName].$("#dataSourceType").val(type);
	    parent.layer.close(index);
		}
	$("tr").live("click", function () {
		     if ($(this).hasClass("bgRed")) {
		         $(this).removeClass("bgRed").find(":radio").attr("checked", false);
		     } else {
		                $(this).addClass("bgRed").find(":radio").attr("checked", true);
		            }
		 });
</script>